Conventionally, in semiconductor integrated circuit devices (which will be hereinafter referred to as “semiconductor devices”) such as a microcomputer, in order to supply a clock signal to a circuit that uses the clock signal, there are a case where a crystal resonator is used as an external component of the semiconductor device and a case where an RC (resistive element and capacitor element) circuit is used as the external component. As described above, oscillators can be broadly classified into two types: a crystal oscillator that uses a crystal resonator and an RC oscillator that uses a RC circuit. Though the crystal oscillator has an advantage that it has a high accuracy of oscillation frequency, it is necessary to mount a rather expensive crystal resonator as the external component. Thus, its price becomes high. On contrast therewith, the RC oscillator uses the RC circuit in place of the crystal resonator. Thus, its price becomes inexpensive, but the accuracy of oscillation frequency is low.
Since each of the oscillators has the characteristics as described above, it is desirable that the user of the semiconductor devices can select the oscillator according to his application. The respective oscillators, however, have different principles of oscillation. Thus, in order to enable the oscillator to be operated, a dedicated oscillating circuit becomes necessary. For this provision, following two methods can be considered.
The first method is to fabricate the semiconductor devices suited for the type of the oscillator. In this case, there is the need to fabricate two types of the semiconductor devices.
The second method is to include oscillating circuits suited for the respective oscillators in one semiconductor device and enable selection of one of the oscillators in some way. In this case, fabrication of just one type of the semiconductor devices suffices.
In view of the number of man-hours for development, a development period, and costs, the second method that needs less types of products for development is more desirable than the first method. The challenge in the second method is how to make oscillator selection. As its easy method, a configuration can be conceived in which connection terminals for connecting elements required for the operation of the oscillators are provided, and the semiconductor device selects the oscillator according to each of the elements connected to the connection terminals.
However, in this method, in addition to two connection terminals for connecting each of the external components, an additional connection terminal becomes necessary in order to input a signal for operating each of the oscillating circuits for the external components. When a package with a small number of pins, which will become the connection terminals, is used, this method is not desirable. For this reason, the method in which the number of the connection terminals for use is limited to the fewest possible two terminals to permit selection of either of the two oscillators is strongly demanded. There is disclosed an example of the oscillator circuit for implementing this method (refer to Patent Document 1, for example).
The conventional oscillator circuit described above will be described.
FIG. 9 is a circuit diagram showing a configuration of the conventional oscillator circuit.
As shown in FIG. 9, the oscillator circuit includes connection terminals 10a and 10b for connecting a crystal resonator or an RC circuit as the external component, a circuit for crystal oscillation (termed as “a crystal oscillating circuit”) 12 which causes the crystal resonator to operate, a circuit for RC oscillation (termed as “an RC oscillating circuit”) 18 which generates a clock signal using the RC circuit, a transistor (Tr-A) for control signal 14 for outputting a control signal, and a comparator 16 for outputting an oscillator selection signal that is the signal for selecting the oscillating circuit according to a difference between the external components. The oscillator circuit further includes an inverter 75 and gates 71 to 74 for connecting the crystal oscillating circuit 12 or the RC oscillating circuit 18 to the connection terminal 10a and 10b in response to an oscillator selection signal output from the comparator 16. A resistive element in the RC circuit connected to the connection terminals 10a and 10b will be hereinafter referred to as external resistive element. Meanwhile, the crystal resonator which is connected across the terminals 10a and 10b as the external component and the crystal oscillating circuit 12 compose a crystal oscillator and the RC circuit which is connected across the terminals 10a and 10b as the external component and the RC oscillating circuit 18 compose an RC oscillator.
To the comparator 16, the potential at the connection node between the drain electrode of the transistor for control signal 14 and the connection terminal 10a is supplied as an input potential V1. The value of the input potential V1 differs, depending on the case where the external component is the crystal resonator or the RC circuit.
The comparator 16 determines whether the input potential V1 is larger than a preset reference voltage SV or not. If the input potential V1 is smaller, the comparator 16 outputs the oscillator selection signal at a High level. On the contrary, if the input potential V1 is larger, the comparator 16 outputs the oscillator selection signal at a Low level. When the oscillator selection signal output from the comparator 16 is at the High level, the gates 71 and 72 are turned on to connect the crystal oscillating circuit 12 to the connection terminals 10a and 10b. When the oscillator selection signal output from the comparator 16 is at the Low level, the oscillator selection signal passes through the inverter 75. The signal at the High level is thereby supplied to the gates 73 and 74. Then, the gates 73 and 74 are turned on to connect the RC oscillating circuit 18 to the connection terminals 10a and 10b. 
When the ON resistance of the transistor for control signal 14 is indicated by Rn, the resistance of the external resistive element is indicated by Rb, and the resistance of a feedback resistance RA of the crystal oscillating circuit 12 is indicated by Ra, the relationship among the resistances Rn, Rb, and Ra generally becomes Rn<<Rb<Ra.
Next, an operation of the oscillator circuit described above will be described. Since configurations of the RC oscillating circuit 18 and the gates 71 to 74 are the same as those in FIG. 9, illustration of them will be omitted.
FIG. 10a is a diagram for explaining the operation of the oscillator circuit when the crystal resonator is connected thereto as the external component so as to operate the crystal oscillator.
As shown in FIG. 10a, when a crystal resonator Q is connected to the connection terminals 10a and 10b as the external component to turn on the transistor for control signal 14, the input potential V1 to the comparator 16 is comparable to the ground potential GND (which will be simply referred to as GND) level because of the relationship of Rn<<Ra, and becomes smaller than a reference voltage SV. For this reason, the oscillator selection signal output from the comparator 16 goes High. On receipt of the oscillator selection signal at the High level, the gates 71 and 72 are turned on to connect the crystal oscillating circuit 12 to the control terminals 10a and 10b. The crystal oscillating circuit 12 is thereby operated.
FIG. 10b is a diagram for explaining the operation of the oscillator circuit when the RC circuit is connected thereto as the external component so as to operate the RC oscillator.
As shown in FIG. 10b, an external resistive element RB of the RC circuit is connected across the connection terminals 10a and 10b as the external component. Further, one of the terminals of a capacitor C is connected to the connection terminal 10a, and the other terminal is connected to GND. When the transistor for control signal 14 is then turned on, the input potential V1 becomes close to the GND level because of the relationship of Rn<<Rb. However, since Rb<Ra holds, a current path occurs in the external resistive element RB. Thus, compared with the case where the crystal resonator Q is connected as the external component, the value of the input potential V1 becomes larger than the reference voltage SV. For this reason, the oscillator selection signal output from the comparator 16 goes Low. Upon receipt of the signal that has passed through the inverter 75, the gates 73 and 74 are turned on, thereby to connect the RC oscillating circuit 18 to the connection terminals 10a and 10b. The RC oscillating circuit 18 is thereby operated.
As described above, by setting the reference voltage SV so that the oscillator selection signal from the comparator 16 differs depending on the case where the crystal resonator Q is connected as the external component or the case where the RC circuit is connected as the external component, selection of each of the oscillators becomes possible.
[Patent Document 1]
Japanese Patent Kokai Publication No. JP-A-1-261007